package com.zbb.base.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor

public class Result {

    /**
     * 错误信息
     **/
    private String errorMsg;
    /**
     * 请求状态 200-成功 400-失败
     **/
    private Integer status;
    /**
     * 返回结果
     **/
    private Object data;

    public static Result ok() {
        return new Result( null, 200,null);
    }

    public static Result ok(Object data) {
        return new Result(null, 200,data);
    }

    public static Result ok(List<?> data) {
        return new Result( null, 200,data);
    }

    public static Result fail(String errorMsg) {
        return new Result( errorMsg, 400,null);
    }
}
